home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
source.lzh
/
SOURCE
/
FuncEnemy
/
BOSS04.C
< prev
next >
Wrap
Text File
|
2000-03-27
|
12KB
|
303 lines
/*
#include <stdio.h>
#include <iocslib.h>
void key_wait( void );
#define BIT(i) (1<<(i))
*/
/*
背景にぶつかり跳ね返る
*/
#include <xsp2lib.h>
#include "../SPASSION.H"
#include "../player.h"
#include "../enemy.h"
#include "../eshot.h"
#include "../effect.h"
#include "../priority.h"
#include "../sound.h"
#include "../entry.h"
#ifndef NULL
#define NULL ((void *) 0)
#endif
#define PALET_MAIN 0x0700
static short MoveEnemyBoss04(ENEMY *);
/*static void TiniEnemyBoss04(ENEMY *);*/
/* 上部分 */
static HIT_XY4 hitup_p[5]={ -16-PLAYER_HIT_X, -16-PLAYER_HIT_Y, 16+PLAYER_HIT_X, -10+PLAYER_HIT_Y,};
static HIT_XY4 hitup_s[5]={ -16, -16, 16, -12,};
/* 下部分 */
static HIT_XY4 hitdown_p[5]={ -16-PLAYER_HIT_X, 10-PLAYER_HIT_Y, 16+PLAYER_HIT_X, 16+PLAYER_HIT_Y,};
static HIT_XY4 hitdown_s[5]={ -16, 12, 16, 16,};
/* 左上部分 */
static HIT_XY4 hitleftup_p[5]={-18-PLAYER_HIT_X, -18-PLAYER_HIT_Y, -8+PLAYER_HIT_X, -8+PLAYER_HIT_Y,};
static HIT_XY4 hitleftup_s[5]={-18, -18, -8, -8,};
/* 右上部分 */
static HIT_XY4 hitrightup_p[5]={8-PLAYER_HIT_X, -18-PLAYER_HIT_Y, 18+PLAYER_HIT_X, -8+PLAYER_HIT_Y,};
static HIT_XY4 hitrightup_s[5]={8, -18, 18, -8,};
/* 左下部分 */
static HIT_XY4 hitleftdown_p[5]={-18-PLAYER_HIT_X, 8-PLAYER_HIT_Y, -8+PLAYER_HIT_X, 18+PLAYER_HIT_Y,};
static HIT_XY4 hitleftdown_s[5]={-18, 8, -8, 18,};
/* 右下部分 */
static HIT_XY4 hitrightdown_p[5]={8-PLAYER_HIT_X, 8-PLAYER_HIT_Y, 18+PLAYER_HIT_X, 18+PLAYER_HIT_Y,};
static HIT_XY4 hitrightdown_s[5]={8, 8, 18, 18,};
extern HIT_XY4 nohit;
static unsigned char seed=0;
/* 当たり判定の初期化 */
void InitEnemyBoss04Hit( void )
{
short i;
for(i=1;i<5;i++){
hitup_p[i].x1= hitup_p[0].x1; hitup_p[i].y1= hitup_p[0].y1; hitup_p[i].x2= hitup_p[0].x2; hitup_p[i].y2= hitup_p[0].y2;
hitup_s[i].x1= hitup_s[0].x1; hitup_s[i].y1= hitup_s[0].y1; hitup_s[i].x2= hitup_s[0].x2; hitup_s[i].y2= hitup_s[0].y2;
hitdown_p[i].x1=hitdown_p[0].x1;hitdown_p[i].y1=hitdown_p[0].y1;hitdown_p[i].x2=hitdown_p[0].x2;hitdown_p[i].y2=hitdown_p[0].y2;
hitdown_s[i].x1=hitdown_s[0].x1;hitdown_s[i].y1=hitdown_s[0].y1;hitdown_s[i].x2=hitdown_s[0].x2;hitdown_s[i].y2=hitdown_s[0].y2;
hitleftup_p[i].x1=hitleftup_p[0].x1-i*4;hitleftup_p[i].y1=hitleftup_p[0].y1-i*4;
hitleftup_p[i].x2=hitleftup_p[0].x2-i*4;hitleftup_p[i].y2=hitleftup_p[0].y2-i*4;
hitrightup_p[i].x1=hitrightup_p[0].x1+i*4;hitrightup_p[i].y1=hitrightup_p[0].y1-i*4;
hitrightup_p[i].x2=hitrightup_p[0].x2+i*4;hitrightup_p[i].y2=hitrightup_p[0].y2-i*4;
hitleftdown_p[i].x1=hitleftdown_p[0].x1-i*4;hitleftdown_p[i].y1=hitleftdown_p[0].y1+i*4;
hitleftdown_p[i].x2=hitleftdown_p[0].x2-i*4;hitleftdown_p[i].y2=hitleftdown_p[0].y2+i*4;
hitrightdown_p[i].x1=hitrightdown_p[0].x1+i*4;hitrightdown_p[i].y1=hitrightdown_p[0].y1+i*4;
hitrightdown_p[i].x2=hitrightdown_p[0].x2+i*4;hitrightdown_p[i].y2=hitrightdown_p[0].y2+i*4;
hitleftup_s[i].x1=hitleftup_s[0].x1-i*4;hitleftup_s[i].y1=hitleftup_s[0].y1-i*4;
hitleftup_s[i].x2=hitleftup_s[0].x2-i*4;hitleftup_s[i].y2=hitleftup_s[0].y2-i*4;
hitrightup_s[i].x1=hitrightup_s[0].x1+i*4;hitrightup_s[i].y1=hitrightup_s[0].y1-i*4;
hitrightup_s[i].x2=hitrightup_s[0].x2+i*4;hitrightup_s[i].y2=hitrightup_s[0].y2-i*4;
hitleftdown_s[i].x1=hitleftdown_s[0].x1-i*4;hitleftdown_s[i].y1=hitleftdown_s[0].y1+i*4;
hitleftdown_s[i].x2=hitleftdown_s[0].x2-i*4;hitleftdown_s[i].y2=hitleftdown_s[0].y2+i*4;
hitrightdown_s[i].x1=hitrightdown_s[0].x1+i*4;hitrightdown_s[i].y1=hitrightdown_s[0].y1+i*4;
hitrightdown_s[i].x2=hitrightdown_s[0].x2+i*4;hitrightdown_s[i].y2=hitrightdown_s[0].y2+i*4;
}
}
void InitEnemyBoss04(ENEMY *ene)
{
ene->vx = -1 * 65536;
ene->vy = 8 * 65536;
ene->hit_p[0] = &hitup_p[0];ene->hit_p[1] = &hitdown_p[0];
ene->hit_p[2] = &hitleftup_p[0];ene->hit_p[3] = &hitrightup_p[0];
ene->hit_p[4] = &hitleftdown_p[0];ene->hit_p[5] = &hitrightdown_p[0];
ene->hit_p[6]=NULL;
ene->hit_o[0] = &nohit;ene->hit_o[1] = &nohit;
ene->hit_o[2] = &nohit;ene->hit_o[3] = &nohit;
ene->hit_o[4] = &nohit;ene->hit_o[5] = &nohit;
ene->hit_o[6]=NULL;
ene->hit_s[0] = &hitup_s[0];ene->hit_s[1] = &hitdown_s[0];
ene->hit_s[2] = &hitleftup_s[0];ene->hit_s[3] = &hitrightup_s[0];
ene->hit_s[4] = &hitleftdown_s[0];ene->hit_s[5] = &hitrightdown_s[0];
ene->hit_s[6]=NULL;
ene->pt = obj_boss4;
ene->info = PALET_MAIN | PRIORITY_BOSS;
ene->angle = 0;
ene->func_enemy_move = MoveEnemyBoss04;
/* ene->func_enemy_tini = TiniEnemyBoss04;*/
ene->parts1=MakeEnemy(ENEMY_CORE , ene->x , ene->y, 2, ene);
ene->parts1->parts1=MakeEnemy(ENEMY_SHIELD , ene->parts1->x-12, ene->parts1->y,0, ene->parts1);
ene->parts1->parts2=MakeEnemy(ENEMY_SHIELD , ene->parts1->x+12, ene->parts1->y,1, ene->parts1);
ene->work=0;
entry_counter_stop = !0; /* エントリーカウンター停止 */
}
static short MoveEnemyBoss04( ENEMY *ene )
{
short anim_num=0;
short Wait( ENEMY *ene, short time );
/* 爆発 */
if( ene->dead_count ){
ene->dead_count++;
if( ene->y > 256+40+16 ){
ene->child_death=1;
if(!ene->parent){
entry_counter_stop = 0; /* エントリーカウンター停止解除 */
return (0); /* 消去 */
}else{ /* ラスボスに呼び出された場合は解除しない */
if( ene->child_kill )
return (0); /* 消去 */
}
}else{
if( !(ene->dead_count%20) ){
short exp_x,exp_y,x,y;
exp_x=rndtable[seed++]&31;seed&=255;
exp_y=rndtable[seed++]&31;seed&=255;
if( rndtable[seed++]>128 ){exp_x*=-1;exp_y*=-1;seed&=255;}
MakeEffect(EFFECT_EXPLMINI, 0, (x=ene->x+exp_x-8), (y=ene->y+exp_y-8));
SetSE(SE_EXPL_MBOSS); /* 爆発音 */
if( !(ene->dead_count%60) ){
MakeEffect(EFFECT_EXPL, 0, ene->x, ene->y);
MakeEffect(EFFECT_HAHENMINI, 0, x, y);
SetSE(SE_EXPL_BOSS); /* 爆発音 */
}
}
ene->y = (ene->ly += 65536/2) >> 16;
xobj_set_st(ene);
return (1);
}
}
/* 速度を足して上位ワード(固定整数部)だけ取り出す */
/* 本体 */
ene->x = (ene->lx += ene->vx) >> 16;
ene->y = (ene->ly += ene->vy) >> 16;
/* コア */
ene->parts1->x=((ene->parts1->lx=ene->lx)>>16)-8;
ene->parts1->y=((ene->parts1->ly=ene->ly)>>16)-8;
/* シールド */
ene->parts1->parts1->x=((ene->parts1->parts1->lx=ene->parts1->lx-12*65536)>>16)-8; /*-8は表示位置をずらすため*/
ene->parts1->parts1->y=((ene->parts1->parts1->ly=ene->parts1->ly )>>16)-8;
ene->parts1->parts2->x=((ene->parts1->parts2->lx=ene->parts1->lx+12*65536)>>16)-8; /*-8は表示位置をずらすため*/
ene->parts1->parts2->y=((ene->parts1->parts2->ly=ene->parts1->ly )>>16)-8;
map_x-=map_vx;
switch (ene->work){
case 0: /* 登場 */
if( ENE_Y < 64+16 || ENE_Y > 192+16 ){
ene->vy*=-1;
SetSE(SE_ESHOT_PARABOLA); /* ぶつかった音 */
}
if( ENE_X < 16+16 ){
ene->vx*=-1;
ene->count++;
ene->work++;
SetSE(SE_ESHOT_PARABOLA); /* ぶつかった音 */
}
break;
case 1:
if( ENE_Y < 64+16 || ENE_Y > 192+16 ){
ene->vy*=-1;
SetSE(SE_ESHOT_PARABOLA); /* ぶつかった音 */
}
if( ENE_X < 16+16 || ENE_X > 200+16 ){
ene->vx*=-1;
ene->count++;
SetSE(SE_ESHOT_PARABOLA); /* ぶつかった音 */
}
if( ene->count > 0 && (ENE_X>112+16 && ENE_X<144+16) && (ENE_Y>124+16 && ENE_Y<132+16) ){
ene->move_ax=ene->vx; /* 加速度保存 */
ene->move_ay=ene->vy;
ene->vx=0;
ene->vy=0;
ene->count=0;
ene->work++;
}
break;
case 2: /* 時間稼ぎ */
if( Wait( ene, 20 ) )ene->work++;
break;
case 3: /* 変形、コアのシャッターを開く */
anim_num=(++ene->anim_count)/8;
ene->pt = obj_boss4+anim_num;
ene->hit_p[2] = &hitleftup_p[anim_num];ene->hit_p[3] = &hitrightup_p[anim_num];ene->hit_p[4] = &hitleftdown_p[anim_num];ene->hit_p[5] = &hitrightdown_p[anim_num];
ene->hit_s[2] = &hitleftup_s[anim_num];ene->hit_s[3] = &hitrightup_s[anim_num];ene->hit_s[4] = &hitleftdown_s[anim_num];ene->hit_s[5] = &hitrightdown_s[anim_num];
ene->parts1->pt=obj_obj+anim_num;
if( anim_num == 4){
SetSE(SE_TRANSFORM); /* ガチャン */
ene->work++;
}
break;
case 4: /* 拡散弾 */
if( !Wait( ene, 80 ) ){
if( ene->count == 20 ){
if(level>=NOMAL){
MakeEShot(ESHOT_HOMING, ENE_X+32, ENE_Y-32, 5, 32, 4,0,ene);MakeEShot(ESHOT_HOMING, ENE_X+32, ENE_Y-32,13, 32, 4,0,ene);
MakeEShot(ESHOT_HOMING, ENE_X+32, ENE_Y+32, 5, 96, 4,0,ene);MakeEShot(ESHOT_HOMING, ENE_X+32, ENE_Y+32,13, 96, 4,0,ene);
MakeEShot(ESHOT_HOMING, ENE_X-32, ENE_Y+32, 5,160, 4,0,ene);MakeEShot(ESHOT_HOMING, ENE_X-32, ENE_Y+32,13,160, 4,0,ene);
MakeEShot(ESHOT_HOMING, ENE_X-32, ENE_Y-32, 5,224, 4,0,ene);MakeEShot(ESHOT_HOMING, ENE_X-32, ENE_Y-32,13,224, 4,0,ene);
SetSE(SE_ESHOT_HOMING); /* 敵ショット音 */
}
}else if( ene->count == 40 ){
MakeEShot(ESHOT_CUTTER, ENE_X+32, ENE_Y-32,13, 32, 4,0,ene);MakeEShot(ESHOT_CUTTER, ENE_X+32, ENE_Y-32,23, 32, 4,0,ene);
MakeEShot(ESHOT_CUTTER, ENE_X+32, ENE_Y+32,13, 96, 4,0,ene);MakeEShot(ESHOT_CUTTER, ENE_X+32, ENE_Y+32,23, 96, 4,0,ene);
MakeEShot(ESHOT_CUTTER, ENE_X-32, ENE_Y+32,13,160, 4,0,ene);MakeEShot(ESHOT_CUTTER, ENE_X-32, ENE_Y+32,23,160, 4,0,ene);
MakeEShot(ESHOT_CUTTER, ENE_X-32, ENE_Y-32,13,224, 4,0,ene);MakeEShot(ESHOT_CUTTER, ENE_X-32, ENE_Y-32,23,224, 4,0,ene);
if(level>=HARD){
MakeEShot(ESHOT_CUTTER, ENE_X , ENE_Y-32,13, 0, 4,0,ene);MakeEShot(ESHOT_CUTTER, ENE_X , ENE_Y-32,23, 0, 4,0,ene);
MakeEShot(ESHOT_CUTTER, ENE_X , ENE_Y+32,13,128, 4,0,ene);MakeEShot(ESHOT_CUTTER, ENE_X , ENE_Y+32,23,128, 4,0,ene);
}
SetSE(SE_ESHOT_CUTTER); /* 敵ショット音 */
}else if( ene->count == 60 ){
MakeEShot(ESHOT_PARACHUTE, ENE_X+32, ENE_Y-32,13, 16, 4,0,ene);
MakeEShot(ESHOT_PARACHUTE, ENE_X+32, ENE_Y-32,13, 32, 4,0,ene);
MakeEShot(ESHOT_PARACHUTE, ENE_X-32, ENE_Y-32,13,240, 4,0,ene);
MakeEShot(ESHOT_PARACHUTE, ENE_X-32, ENE_Y-32,13,224, 4,0,ene);
SetSE(SE_ESHOT_PARACHUTE); /* 敵ショット音 */
}
}else{
SetSE(SE_ESHOT_SYURIKEN); /* 次のショット音 */
ene->work++;
}
break;
case 5:
/* リング(大) */
if(level>=NOMAL){
MakeEShot(ESHOT_RING02, ENE_X, ENE_Y, 5, ene->angle, 4,0,ene);
if(level>=HARD)
MakeEShot(ESHOT_PARABOLA, ENE_X, ENE_Y, 20, (ene->angle+8)&255, 4,0,ene);
}
if( (ene->angle+=16)>255 ){
ene->angle=0;
ene->work++;
}
break;
case 6: /* 時間稼ぎ */
if( Wait( ene, 120 ) ){
ene->work++;
}
break;
case 7: /* 変形、コアのシャッターを閉じる */
anim_num=(--ene->anim_count)/8;
ene->pt = obj_boss4+anim_num;
ene->hit_p[2] = &hitleftup_p[anim_num];ene->hit_p[3] = &hitrightup_p[anim_num];ene->hit_p[4] = &hitleftdown_p[anim_num];ene->hit_p[5] = &hitrightdown_p[anim_num];
ene->hit_s[2] = &hitleftup_s[anim_num];ene->hit_s[3] = &hitrightup_s[anim_num];ene->hit_s[4] = &hitleftdown_s[anim_num];ene->hit_s[5] = &hitrightdown_s[anim_num];
ene->parts1->pt=obj_obj+anim_num;
if( !anim_num ){
SetSE(SE_TRANSFORM); /* ガチャン */
ene->work=1;
ene->vx=ene->move_ax; /* 加速度復帰 */
ene->vy=ene->move_ay;
ene->anim_count=0;
}
}
if( ene->parts1->child_death ){
MakeEffect(EFFECT_EXPL, 0, ene->x, ene->y);
SetSE(SE_EXPL_BOSS); /* 爆発音 */
MakeEffect (EFFECT_HAHEN, 0, ene->x, ene->y);
if(!eshot_erase)
eshot_erase = ESHOT_ERASE; /* 弾消し */
ene->player->score += 20;
ene->parts1->child_kill=1;
ene->hit_p[0]=NULL;
ene->dead_count=1;
}
/* ダメージを受けた時の処理 */
if(ene->damage){
SetSE(SE_DAMAGE); /* 効果音 */
ene->damage = 0;
}
xobj_set_st(ene);
xsp_set_st(ene->parts1);
xsp_set_st(ene->parts1->parts1);
xsp_set_st(ene->parts1->parts2);
return(1);
}
/*
static void TiniEnemyBoss04(ENEMY * p)
{
}
*/